Project Best Practices for MCP Development.md•7.41 kB
<img src="https://r2cdn.perplexity.ai/pplx-full-logo-primary-dark%402x.png" class="logo" width="120"/>
#
---
# Project Best Practices for MCP Development
## MCP Best Practices
1. **Standardized Tool Naming**
- Use descriptive, lowercase names with underscores
- Follow the pattern: `[service]_[action]_[object]`
- Example: `github_create_repository`, `todoist_update_task`
2. **Parameter Validation**
- Always validate input parameters before processing
- Return clear error messages for invalid inputs
- Include parameter type specifications in tool definitions
3. **Error Handling**
- Implement proper try/catch blocks for all API calls
- Return structured error objects with code and description
- Log errors for debugging but sanitize sensitive information
4. **Authentication Management**
- Use environment variables for API keys and tokens
- Never hardcode credentials in server code
- Implement token refresh mechanisms where applicable
5. **Performance Optimization**
- Cache repetitive API calls when appropriate
- Implement request throttling to avoid rate limits
- Split complex operations into smaller tools for better reusability
## Smithery-Specific Rules
1. **Configuration Schema**
- Define complete `configSchema` in `smithery.yaml`
- Document all configuration options thoroughly
- Mark required parameters appropriately
2. **Command Generation**
- Use the correct environment variable mapping in `commandFunction`
- Ensure proper escaping of special characters in config strings
- Follow the Smithery startup protocol for proper initialization
3. **Server Structure**
- Implement required MCP protocol methods
- Use the latest `@modelcontextprotocol/sdk` version
- Structure projects with clear separation of concerns
4. **Deployment Best Practices**
- Include proper Dockerfile configuration
- Specify all dependencies in package.json
- Set appropriate NODE_ENV for production deployments
5. **Versioning**
- Use semantic versioning for all MCP servers
- Document breaking changes between versions
- Provide upgrade paths for major version changes
## Cursor IDE Integration
1. **MCP Server Registration**
- Use consistent naming in `mcp.json`
- Follow the standard command structure:
```json
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"[package-name]",
"--config",
"[escaped-json-config]"
]
```
2. **Tool Discovery**
- Refresh tools after configuration changes
- Verify green dot status for enabled servers
- Check console for connection errors
3. **Configuration Management**
- Escape quotes correctly in config strings (use `\"` for quotes inside config)
- Use environment-specific configurations for different environments
- Document required API keys and tokens
4. **Troubleshooting**
- Check "No resources available" warnings in Cursor IDE
- Verify network connectivity to API endpoints
- Monitor token usage and rate limits
5. **Performance**
- Order servers by frequency of use for faster tool discovery
- Configure timeout settings appropriately
- Use local servers for development when possible
---
# Cursor MCP Rules
## Default Servers (IN ORDER)
### MCP Server 1: Sequential Thinking
**Tool Name:** sequentialthinking
**Description:** Structured problem-solving with hypothesis management and session logging.
**When to use:** Complex logical problems, debugging, and step-by-step analysis.
### MCP Server 2: Todoist
**Tool Names:**
- todoist_create_task
- todoist_get_tasks
- todoist_update_task
- todoist_delete_task
- todoist_complete_task
**Description:** Task management integration.
**When to use:** Project planning, task tracking, and deadline management.
### MCP Server 3: GitHub
**Tool Names:**
- create_or_update_file
- search_repositories
- create_repository
- get_file_contents
- push_files
- create_issue
- create_pull_request
- fork_repository
- create_branch
- list_commits
- list_issues
- update_issue
- add_issue_comment
- search_code
- search_issues
- search_users
- get_issue
**Description:** GitHub integration for repository and code management.
**When to use:** Code collaboration, version control, and repository management.
## Additional MCP Servers
### Brave Search
**Tool Names:**
- brave_web_search
- brave_local_search
**Description:** Web search integration.
**When to use:** Research, information gathering, and discovery.
### Perplexity Deep Research
**Tool Name:** deep_research
**Description:** Advanced AI-powered research.
**When to use:** In-depth research requiring sophisticated analysis of web content.
### Devalexandre MCP Servers
**Tool Names:**
- pyppeteer_navigation
- take_screenshot
- click_element
- exit_server
**Description:** Browser automation tools.
**When to use:** Web scraping, testing, and UI automation.
### Neon DB
**Tool Names:**
- __node_version
- list_projects
- create_project
- delete_project
- prepare_database_migration
- complete_database_migration
- describe_project
- describe_table_schema
- get_database_tables
- create_branch
- run_sql
- run_sql_transaction
- describe_branch
- delete_branch
- get_connection_string
- provision_neon_auth
**Description:** Database management.
**When to use:** Database operations, migrations, and SQL queries.
### FireCrawl MCP
**Tool Names:**
- firecrawl_scrape
- firecrawl_map
- firecrawl_crawl
- firecrawl_deep_research
- firecrawl_batch_scrape
- firecrawl_check_batch_status
- firecrawl_check_crawl_status
- firecrawl_search
- firecrawl_extract
**Description:** Advanced web scraping.
**When to use:** Content extraction, site mapping, and large-scale web crawling.
## MCP Server Selection Guidelines
- Use Sequential Thinking for complex problem-solving and planning
- Use GitHub for all code and repository-related operations
- Use Brave Search for quick information lookup
- Use Todoist for project and task management
- Use Neon DB for database operations
- Use FireCrawl for advanced web scraping needs
- Use Perplexity for in-depth research requiring sophisticated analysis
- Use Devalexandre tools for browser automation and screenshots
## Tool Execution Protocol
1. Identify the appropriate tool based on the task requirements
2. Use the full tool name when invoking (e.g., "github_create_repository")
3. Provide all required parameters in the correct format
4. Handle any errors or unexpected responses appropriately
5. Confirm successful tool execution before proceeding
## Usage Notes
- Always try MCP tools before manual implementation of functionality
- If a tool fails, verify server status before attempting alternatives
- Some tools require authentication tokens which must be configured
- Complex workflows may require chaining multiple tools together
- Respect rate limits and usage quotas of underlying services
<div style="text-align: center">⁂</div>
[^1]: https://pplx-res.cloudinary.com/image/upload/v1742942047/user_uploads/ZyqsNIkkkuKueqU/image.jpg
[^2]: https://pplx-res.cloudinary.com/image/upload/v1742942066/user_uploads/RpFOwYlSkfbzvbh/image.jpg
[^3]: https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/17146172/bca66741-9637-4a7f-b0b7-3e88bf3e9130/mcp.rules.md
[^4]: https://pplx-res.cloudinary.com/image/upload/v1742944001/user_uploads/uThfdtgctaUXHgK/image.jpg